<template>
    <el-config-provider :locale="locale">
        <div id="app">
            <router-view />
        </div>
    </el-config-provider>
</template>
<script lang="ts">
import { defineComponent } from "vue";
import { useStore, mapMutations } from "vuex";
import { ElConfigProvider } from 'element-plus';
import zhCn from 'element-plus/lib/locale/lang/zh-cn';
export default defineComponent({
    name: "App",
    components: { [ElConfigProvider.name]: ElConfigProvider },
    setup() {
        // 全局禁止在浏览器点击右键弹出 默认菜单
        document.oncontextmenu = (oEvent: any) => {
            if (window.event) {
                oEvent = window.event; // 处理兼容性，获得事件对象
                oEvent.returnValue = false;
            } else {
                oEvent.preventDefault();
            }
        };
        const store = useStore();
        const minHeight = 500;
        const minWidth = 1000;
        const func = () => {
            let height = window.innerHeight;
            // document.body.clientHeight ||  document.documentElement.clientHeight;
            let width = window.innerWidth;
            // document.body.clientWidth || document.documentElement.clientWidth;
            if (height < minHeight) {
                height = minHeight;
            }
            if (width < minWidth) {
                width = minWidth;
            }
            store.commit("updateBodySize", { height, width });
        };
        func();
		
        window.onresize = func;
        return {
            locale: zhCn,
        };
    },
});
</script>
